package com.geeke.org.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.geeke.common.persistence.TreeEntity;
import com.geeke.sys.entity.User;
import java.util.*;

/**
 * 部门Entity
 * 
 * 重要说明：
 *   如果表中包含`name`或`remarks`字段，必须在实体类中显式定义`name`或`remarks`属性。
 *   这些字段的属性已经包含在基类中，无需在实体类定义：`id`, `createBy`, `createDate`, `updateBy`, `updateDate`, `delFlag`, `parent`, `ids`, `sort`
 */
public class Department extends TreeEntity<Department> {

    private static final long serialVersionUID = 1L;
    
    // Constructor
    public Department() {
        super();
    }
    
    public Department(String id) {
        super(id);
    }

    // 有name字段，则必须显示定义
    @Length(min=1, max=128, message="名称长度必须介于1和128之间")
    @NotBlank(message="名称不能为空")
    private String name; // 名称
    
    // 有remarks字段，则必须显示定义
    @Length(min=0, max=255, message="备注信息长度必须介于0和255之间")
    private String remarks; // 备注信息

    @NotNull(message="公司不能为空")
    private Company company; // 公司
    
    @Length(min=1, max=64, message="编号长度必须介于1和64之间")
    @NotBlank(message="编号不能为空")
    private String code; // 编号
    
    private User director; // 总监
    
    private User manager; // 经理

    // Getters and setters
    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public User getDirector() {
        return director;
    }

    public void setDirector(User director) {
        this.director = director;
    }

    public User getManager() {
        return manager;
    }

    public void setManager(User manager) {
        this.manager = manager;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks; 
    }
    public String getTableAlias() {
        return "department";
    }
    
} 